#include<stdio.h>

int count=0;
int Bsearch(int *a, int n, int k,int *p);
int main(){
     int n,cmp,*p=&cmp;
     int pos,num=0;
     int low=0,high,mid,k;
     while(~scanf("%d",&n))
    {
          int a[n];
      for(int i=0;i<n;i++)
      scanf("%d",&a[i]);
       scanf("%d",&k);
       int pos=Bsearch(a,n,k,p);
       printf("%d\n%d\n",pos,cmp);
    }
    return 0;
}
/* 请在这里填写答案 */
//int arr[]={1,2,3};

int Bsearch(int *a, int n, int k,int *p){
    int low =0;
    int count =0;
    int high =n-1;
    while(low<=high){
        count++;
        int mid =(low+high)/2;
        if(k>a[mid])
            low =mid+1;
        else if(k<a[mid])
            high =mid-1;
        else{
            *p=count;
            return mid;
        }

    }
    *p=count;
    return -1;
}

